#define IS_SYSCALL(a)  (((a) & 0xffff) == 0x050f)
#define IS_SYSENTER(a) (((a) & 0xffff) == 0x340f)
#define IS_INT80(a)    (((a) & 0xffff) == 0x80cd)

#define IS_RETN(a) (((a) & 0xff) == 0xc2 || ((a) & 0xff) == 0xc3)
#define IS_RETF(a) (((a) & 0xff) == 0xca || ((a) & 0xff) == 0xcb)

inline int		is_call(unsigned long instr)
{
  return (((instr & 0xffff) == 0xe866) ||
      ((instr & 0xff) == 0x9a) ||
      ((instr & 0xffff) == 0x9a66) ||
      ((instr & 0xff) == 0xe8) ||
      (((instr & 0xff) == 0xff) && ((instr & 0x3800)) >> 11 == 2) ||
      (((instr & 0xff) == 0xff) && ((instr & 0x3800)) >> 11 == 3));
}

inline int		is_rt(unsigned long instr)
{
  return (IS_RETN(instr) || IS_RETF(instr));
}

inline int		is_syscall(unsigned long instr)
{
  return (
      IS_SYSCALL(instr) ||
      IS_SYSENTER(instr) ||
      IS_INT80(instr)
      );
}
